package pl.model.domain;

import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

@Entity
public class Publisher extends AbstractDBObject {

	protected String name;
	protected String city;
	protected String street;
	protected Integer num;
	@Column(unique=true)
	protected String nip; // unique not null
	@OneToMany(mappedBy="publisher")
	protected Collection<Book> books;

	public Publisher(String name, String nip) {
		super();
		this.name = name;
		this.nip = nip;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public Integer getNum() {
		return num;
	}

	public void setNum(Integer no) {
		this.num = no;
	}

	public String getNip() {
		return nip;
	}

	public void setNip(String nip) {
		this.nip = nip;
	}

	public Collection<Book> getBooks() {
		return books;
	}

	public void setBooks(Collection<Book> books) {
		this.books = books;
	}

	@Override
	public String toString() {
		return super.toString() + " ";
	}

	public Publisher(String name, String city, String street, Integer num,
			String nip, Collection<Book> books) {
		super();
		this.name = name;
		this.city = city;
		this.street = street;
		this.num = num;
		this.nip = nip;
		this.books = books;
	}

	public Publisher() {
		super();
	}
}
